#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main()
{
    LL n;
    while(cin >> n)
    {
        LL t = n / 2 + n / 5 + n / 11 + n / 13;
        t -= n / 10 + n / 22 + n / 26 + n / 55 + n / 65 + n / 143;
        t += n / 110 + n / 130 + n / 286 + n / 715;
        t -= n / 1430;
        cout << n - t << endl;
    }
    return 0;
}